package com.xsd.iterator;

import java.util.Iterator;
import java.util.List;

/**
 * @Description: 信息工程学院迭代器
 * @Author: zhoufuzong
 * @Created: 2021-03-06 19:38:42
 * @Version: 1.1.0
 */

public class InfoCollegeIterator implements Iterator {

    List<Department> departmentList;
    // 索引
    int index =-1;
    public InfoCollegeIterator(List<Department> departmentList) {
        this.departmentList = departmentList;
    }

    @Override
    public boolean hasNext() {

        if (index>=departmentList.size()-1){
            return false;
        }{
            index+=1;
            return true;
        }
    }

    @Override
    public Object next() {
        return departmentList.get(index);
    }

    @Override
    public void remove() {

    }
}
